//
//  FactoryProducer.swift
//  AbstactFactoryDemo
//
//  Created by 好米有易 on 2017/9/28.
//  Copyright © 2017年 好米有易. All rights reserved.
//

import UIKit

/// 实例化工厂的类型
///
/// - shape: 形状
/// - color: 颜色
public enum ProducerType {
    case shape
    case color
}


/// 把抽象工厂实例化
public class FactoryProducer: NSObject {

   class public func getFactory(type: ProducerType) -> AbstractFactory {
        
        if type == .shape {
            
            return ShapeFactory()
        }
        
        if type == .color {
            
            return ColorFactory()
        }
    
        return AbstractFactory()
    }
    
}
